package org.common.utils.generatortable.event.entity;

import org.common.utils.generatortable.GeneratorTableManager;

import javax.swing.*;

/**
 * mysql连接事件
 * @author zhouzhibing
 * @date 2025/4/27
 */
public class MysqlConnectionEvent {
    /**
     * mysql地址
     */
    private String host;
    /**
     * 用户名
     */
    private String username;
    /**
     * 密码
     */
    private String password;

    public MysqlConnectionEvent() {
        GeneratorTableManager manager = GeneratorTableManager.getInstance();
        JTextField txtTableHost = manager.getComponent(JTextField.class, "txtMysqlHost");
        JTextField txtUsername = manager.getComponent(JTextField.class, "txtUsername");
        JTextField txtPassword = manager.getComponent(JPasswordField.class, "txtPassword");

        this.host = txtTableHost.getText();
        this.username = txtUsername.getText();
        this.password = txtPassword.getText();
    }

    public String getHost() {
        return host;
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }
}
